package com.vhly.aapt;

import com.vhly.aapt.io.OrderInputStream;

import java.io.IOException;

/**
 * Created by IntelliJ IDEA.
 * User: vhly[FR]
 * Date: 2010-4-26
 * Time: 16:05:24
 */
public class ResXMLTree_cdataExt extends ResXMLTree_node {
    public int dataStringPoolIndex;
    public ResValue value;

    @Override
    public String toXML() {
        String ret = "";
        if (dataStringPoolIndex > -1) {
            ret = pool.entries.get(dataStringPoolIndex);
        } else if (value != null) {
            ret = value.toXML();
        }
        return ret;
    }

    @Override
    public void read(OrderInputStream din) throws IOException {
        super.read(din);
        dataStringPoolIndex = din.readInt();
        value = new ResValue();
        value.read(din);
        value.pool = pool;
    }

    @Override
    public short getHeaderSize() {
        return 0;
    }

    @Override
    public byte[] getData() {
        return new byte[0];
    }
}